package chapter10

import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.types.{DataTypes, StructType}

/**
 * author: 余辉
 * blog: https://blog.csdn.net/silentwolfyh
 * descriptions: 1.1.1.3.从csv文件（带header）进行创建
 * date: 2024 - 09 - 02 2:05 下午
 */
object DataFrameDemo7 {

  def main(args: Array[String]): Unit = {

    val spark: SparkSession = SparkSession.builder()
      .appName(this.getClass.getSimpleName)
      .master("local[*]")
      .getOrCreate()

    val df = spark.read
      .option("header",true) //读取表头信息
      .csv("doc/input/09stu2.csv")
    df.printSchema()
    df.show()
  }

}